AC_INIT(README)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(dashboard, 0.0.1)
AM_MAINTAINER_MODE

AC_PROG_INSTALL
AC_ISC_POSIX
AM_PROG_LIBTOOL
AC_PROG_CC
AC_PROG_CXX

AC_MSG_CHECKING([for platform])
case "$target" in
  *-*-linux*)
    os=linux
    ;;
  *-*-mingw*)
    os=windows
    ;;
  *)
    AC_MSG_ERROR([unsupported platform: $target])
    ;;
esac
AC_MSG_RESULT([$os])
AM_CONDITIONAL(LINUX, test "x$os" = "xlinux")
AM_CONDITIONAL(WINDOWS, test "x$os" = "xwindows")

AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
	AC_MSG_ERROR([You need to install pkg-config])
fi

AC_PATH_PROG(BASH, bash)
AC_PATH_PROG(CHMOD, chmod)
AC_PATH_PROG(SED, sed)

AC_PATH_PROG(MONO, mono)
AC_PATH_PROG(MCS, gmcs)

PKG_CHECK_MODULES(GLIB, glib-2.0 gobject-2.0)
AC_SUBST(GLIB_LIBS)
AC_SUBST(GLIB_CFLAGS)

PKG_CHECK_MODULES(LIBXML, libxml-2.0)
AC_SUBST(LIBXML_LIBS)
AC_SUBST(LIBXML_CFLAGS)

PKG_CHECK_MODULES(BEAGLE, beagle-0.0)
AC_SUBST(BEAGLE_LIBS)

BEAGLE_DIR=`$PKG_CONFIG --variable=dlldir beagle-0.0`
AC_SUBST(BEAGLE_DIR)

PKG_CHECK_MODULES(WNCKSHARP, wnck-sharp)
AC_SUBST(WNCKSHARP_LIBS)

WNCKSHARP_DIR=`$PKG_CONFIG --variable=dlldir wnck-sharp`
AC_SUBST(WNCKSHARP_DIR)

PKG_CHECK_MODULES(GLIBSHARP, glib-sharp-2.0)
AC_SUBST(GLIBSHARP_LIBS)

PKG_CHECK_MODULES(GTKSHARP, gtk-sharp-2.0)
AC_SUBST(GTKSHARP_LIBS)

PKG_CHECK_MODULES(GNOMESHARP, gnome-sharp-2.0)
AC_SUBST(GNOMESHARP_LIBS)

PKG_CHECK_MODULES(RSVGSHARP, rsvg2-sharp-2.0)
AC_SUBST(RSVGSHARP_LIBS)

PKG_CHECK_MODULES(DBUSSHARP, ndesk-dbus-1.0 ndesk-dbus-glib-1.0)
AC_SUBST(DBUSSHARP_LIBS)

PKG_CHECK_MODULES(MONOADDINS, mono-addins)
AC_SUBST(DBUSSHARP_LIBS)

PKG_CHECK_MODULES(MONOCAIRO, mono-cairo)
AC_SUBST(MONOCAIRO_LIBS)

if test "x$prefix" = "x$ac_default_prefix"; then
   PANELAPPLET_LIBDIR=`$PKG_CONFIG --variable=libdir libpanelapplet-2.0`
fi
if test "x$PANELAPPLET_LIBDIR" = "x"; then
   PANELAPPLET_SERVER_DIR="$libdir/bonobo/servers"
else
   PANELAPPLET_SERVER_DIR="$PANELAPPLET_LIBDIR/bonobo/servers"
fi
AC_SUBST(PANELAPPLET_SERVER_DIR)

expanded_libdir=`( case $prefix in NONE) prefix=$ac_default_prefix ;; *) ;; esac
                   case $exec_prefix in NONE) exec_prefix=$prefix ;; *) ;; esac
                   eval echo $libdir )`
AC_SUBST(expanded_libdir)

expanded_datadir=`( case $prefix in NONE) prefix=$ac_default_prefix ;; *) ;; esac
                   case $exec_prefix in NONE) exec_prefix=$prefix ;; *) ;; esac
                   eval echo $datadir )`
AC_SUBST(expanded_datadir)

expanded_bindir=`( case $prefix in NONE) prefix=$ac_default_prefix ;; *) ;; esac
                   case $exec_prefix in NONE) exec_prefix=$prefix ;; *) ;; esac
                   eval echo $bindir )`
AC_SUBST(expanded_bindir)

AC_OUTPUT([
Makefile
data/Makefile
data/dashboard.pc
data/dashboard-engine.pc
data/dictionary/Makefile
data/mappings/Makefile
data/rules/Makefile
data/gazetteer/Makefile
data/icons/Makefile
data/GNOME_DashboardApplet.server
src/Makefile
src/libdashboard/Makefile
src/libdashboardglue/Makefile
src/Dashboard/Makefile
src/Dashboard/AssemblyInfo.cs
src/Dashboard.Util/Makefile
src/Dashboard.Util/AssemblyInfo.cs
src/Dashboard.Util/Dashboard.Util/ConfigureDefines.cs
src/Dashboard.Engine/Makefile
src/Dashboard.Engine/AssemblyInfo.cs
src/Dashboard.Engine.Test/Makefile
src/Dashboard.Engine.Test/dashboard-test
src/Dashboard.Sidebar/Makefile
src/Dashboard.Sidebar/dashboard-sidebar
src/Dashboard.Mint/Makefile
src/Dashboard.Mint/AssemblyInfo.cs
src/Dashboard.Latte/Makefile
src/Dashboard.Latte/dashboard-latte
src/Test/Makefile
])
